﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AmkeniCrossLoginApplication.Data_Access;

namespace AmkeniCrossLoginApplication.Amkeni_Monitoring_Plan
{
    public partial class Test : System.Web.UI.Page
    {
        Amkeni_DatabaseEntities db = new Amkeni_DatabaseEntities();

        protected void Page_Load(object sender, EventArgs e)
        {
            /*monitoring_plan_view newplan = new monitoring_plan_view();
            var plandata = (from data in db.monitoring_plan_view select data).ToList();
            GridView1.DataSource = plandata.ToList();
            GridView1.DataBind();*/

            SqlConnection SQLconn = null;
            try
            {
                string strQuery = "SELECT * FROM monitoring_plan_view where ip_id = 2";
                SQLconn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
                SqlCommand SQLcmd = new SqlCommand();
                SQLcmd.CommandText = strQuery;
                SQLcmd.Connection = SQLconn;
                SQLcmd.Connection.Open();

                SqlDataAdapter sqlDa = new SqlDataAdapter(SQLcmd);
                DataTable dt = new DataTable();
                sqlDa.Fill(dt);
                SQLconn.Close();

                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
    }
}